#ifndef __tenacitas_crosswords1_concept_layouts_tester_h__
#define __tenacitas_crosswords1_concept_layouts_tester_h__

#include <iostream>
#include <cstdint>
#include <string>

#include "runtest.h"

#include <tenacitas.crosswords.core/layouts.h>
#include <tenacitas.return_code.core/rc.h>

namespace tenacitas {
    namespace crosswords {
        namespace concept {



            class layouts_tester {
            private:
                
                struct supplier {
                    struct organizer {};    
                    typedef std::string text;
                };

                typedef concept::layouts<supplier> layouts;
                typedef concept::layouts<supplier> layout;

                typedef concept::word<supplier> word;
                typedef supplier::text text;
                
                static bool test1() {
                    std::cerr << "\n+++ layouts_tester::test1" << std::endl;

                    word _word(text("abacaxi"),
                               text("fruta tropical com coroa"),
                               word::category::easy);
                    
                    layouts _layouts;

                    _layouts.add(_word);

                    _layouts.print(std::cerr);

                    return (_layouts.get_size() == 1);
                }

                static bool test2() {
                    std::cerr << "\n+++ layouts_tester::test2" << std::endl;

                    word _word(text("abacaxi"),
                               text("fruta tropical com coroa"),
                               word::category::easy);
                    
                    layouts _layouts;

                    _layouts.add(_word);

                    _layouts.add(_word);

                    return (_layouts.get_size() == 1);
                }

                static bool test3() {
                    std::cerr << "\n+++ layouts_tester::test3" << std::endl;

                    word _word(text("abacaxi"),
                               text("fruta tropical com coroa"),
                               word::category::easy);
                    
                    layouts _layouts;

                    _layouts.add(_word);

                    _layouts.add(_word);

                    _layouts.print(std::cerr);

                    return (!_layouts.is_positioned());
                }

                static bool test4() {
                    std::cerr << "\n+++ layouts_tester::test4" << std::endl;

                    word _w1(text("abacaxi"),
                             text("fruta tropical com coroa"),
                             word::category::easy);

                    word _w2(text("xixi"),
                             text("sinonimo de urina"),
                             word::category::easy);
                    
                    layouts _layouts;

                    _layouts.add(_w1);
                    _layouts.print(std::cerr);

                    _layouts.add(_w2);
                    _layouts.print(std::cerr);

                    _layouts.print(std::cerr);
                    return (_layouts.get_size() == 2);
                }


            public:
                static void run() {
                    runtest(layouts_tester::test1());
                    runtest(layouts_tester::test2());
                    runtest(layouts_tester::test3());
                    runtest(layouts_tester::test4());
                }
            };
        }
    }
}

#endif
